Skip to content

fix(intellij): embed IntelliJ templates for standalone AOT executables - #1127

Closed
sigurdm wants to merge 2 commits into
invertase:mainfrom
sigurdm:fix/dart-install-aot
Closed

sigurdm wants to merge 2 commits into
invertase:mainfrom
sigurdm:fix/dart-install-aot

Conversation

@sigurdm

@sigurdm sigurdm commented Nov 30, 2026

Copy link
Copy Markdown

Description

As part of preparing ecosystem CLIs for dart install / dart run <pkg>@ (see dart-lang/sdk#64955 and dart-lang/sdk#63186):

When melos is installed as a standalone AOT executable via dart install melos or invoked with dart run melos@, running melos bootstrap with IntelliJ IDE generation enabled crashes with Null check operator used on a null value in _resolveMelosRoot because Isolate.resolvePackageUri returns null in AOT binaries and standalone app bundles do not ship templates/ on disk.

  • Added scripts/generate_templates.dart and generated packages/melos/lib/src/common/intellij_templates.g.dart containing all templates under templates/intellij/.
  • Updated IntellijProject.readFileTemplate to read from intellijTemplates and removed the now-unused disk template path helpers (pathTemplates, pathTemplatesForDirectory, _resolvePathTemplates, _cacheTemplates, and utils.applyPubCacheOverride).
  • Added tests verifying intellijTemplates stays in sync with templates/intellij/*.tmpl.

Type of Change

  • ✨ feat -- New feature (non-breaking change which adds functionality)
  • 🛠️ fix -- Bug fix (non-breaking change which fixes an issue)
  • ❌ ! -- Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 refactor -- Code refactor
  • ✅ ci -- Build configuration change
  • 📝 docs -- Documentation
  • 🗑️ chore -- Chore

Read IntelliJ project templates from a generated Dart map instead of resolving package:melos/melos.dart via Isolate.resolvePackageUri at runtime.

Standalone AOT binaries installed with `dart install melos` or `dart run melos@` do not have package URI resolution or on-disk template files, causing `melos bootstrap` to crash during IntelliJ IDE file generation.

Also replace the null assertion in `_resolveMelosRoot` with a descriptive `StateError` when package URI resolution is unavailable, while keeping `pathTemplates`, `pathTemplatesForDirectory`, and `getMelosRoot` intact for backwards compatibility.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sigurdm

sigurdm commented Dec 1, 2026

Copy link
Copy Markdown
Author

Closing in favor of #1128.

@sigurdm sigurdm closed this Dec 1, 2026
@sigurdm
sigurdm deleted the fix/dart-install-aot branch December 1, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants